﻿using System.ComponentModel.Composition;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Utilities;
using Tvl.VisualStudio.Text.Commenter;
using Tvl.VisualStudio.Text.Commenter.Interfaces;

namespace Language.Intellisense.Commenting
{
    [Export( typeof( ICommenterProvider ) )]
    [ContentType( "redscript" )]
    public sealed class CommenterProvider : ICommenterProvider
    {
        public static readonly LineCommentFormat LineFormat = new LineCommentFormat( "//" );
        public static readonly BlockCommentFormat BlockFormat = new BlockCommentFormat( "/*", "*/" );

        public ICommenter TryCreateCommenter( ITextBuffer textBuffer )
        {
            return textBuffer.Properties.GetOrCreateSingletonProperty( () => new FormatCommenter( textBuffer, LineFormat, BlockFormat ) );
        }
    }
}
